#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
//int main()
//{
//	int a = 3;
//	int b = 5;
//	a = a ^ b;
//	b = a ^ b;
//	a = a ^ b;
//	printf("%d %d", a, b);
//
//
//	return 0;
//}
void hanoi(int n, char F, char A, char T)
{
	if (n == 1)
	{
		printf("move %d from %c to %c\n", n, F, T);
		return;
	}
	else
	{
		hanoi(n - 1, F, T, A);
		printf("move %d from %c to %c\n", n, F, T);
		hanoi(n - 1, A, F, T);
	}
}
int main()
{
	char pos1='F';
	char pos2 = 'A';
	char pos3='T';
	int n = 0;
	scanf("%d", &n);
	hanoi(n, pos1,pos2,pos3);

	return 0;
}